const os = require('os');

function format(byte) {
  return (byte / 1024 / 1024 / 1024).toFixed(2) + 'GB'
}

console.log('系统总内存: ', format(os.totalmem))
console.log('系统闲置内存: ', format(os.freemem))